package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 告警记录表
 * @TableName alert_record
 */
@TableName(value ="alert_record")
@Data
public class AlertRecord implements Serializable {
    /**
     * 告警ID
     */
    @TableId(type = IdType.AUTO)
    private Long alertId;

    /**
     * 规则ID
     */
    private Long ruleId;

    /**
     * 设备ID
     */
    private Long deviceId;

    /**
     * 告警级别
     */
    private Integer alertLevel;

    /**
     * 指标编码
     */
    private String indicatorCode;

    /**
     * 当前值
     */
    private BigDecimal currentValue;

    /**
     * 阈值
     */
    private BigDecimal thresholdValue;

    /**
     * 告警消息
     */
    private String alertMessage;

    /**
     * 告警时间
     */
    private Date alertTime;

    /**
     * 状态：1-未处理，2-已确认，3-已处理
     */
    private Integer status;

    /**
     * 处理人ID
     */
    private Long handlerId;

    /**
     * 处理时间
     */
    private Date handleTime;

    /**
     * 创建时间
     */
    private Date createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        AlertRecord other = (AlertRecord) that;
        return (this.getAlertId() == null ? other.getAlertId() == null : this.getAlertId().equals(other.getAlertId()))
            && (this.getRuleId() == null ? other.getRuleId() == null : this.getRuleId().equals(other.getRuleId()))
            && (this.getDeviceId() == null ? other.getDeviceId() == null : this.getDeviceId().equals(other.getDeviceId()))
            && (this.getAlertLevel() == null ? other.getAlertLevel() == null : this.getAlertLevel().equals(other.getAlertLevel()))
            && (this.getIndicatorCode() == null ? other.getIndicatorCode() == null : this.getIndicatorCode().equals(other.getIndicatorCode()))
            && (this.getCurrentValue() == null ? other.getCurrentValue() == null : this.getCurrentValue().equals(other.getCurrentValue()))
            && (this.getThresholdValue() == null ? other.getThresholdValue() == null : this.getThresholdValue().equals(other.getThresholdValue()))
            && (this.getAlertMessage() == null ? other.getAlertMessage() == null : this.getAlertMessage().equals(other.getAlertMessage()))
            && (this.getAlertTime() == null ? other.getAlertTime() == null : this.getAlertTime().equals(other.getAlertTime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getHandlerId() == null ? other.getHandlerId() == null : this.getHandlerId().equals(other.getHandlerId()))
            && (this.getHandleTime() == null ? other.getHandleTime() == null : this.getHandleTime().equals(other.getHandleTime()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAlertId() == null) ? 0 : getAlertId().hashCode());
        result = prime * result + ((getRuleId() == null) ? 0 : getRuleId().hashCode());
        result = prime * result + ((getDeviceId() == null) ? 0 : getDeviceId().hashCode());
        result = prime * result + ((getAlertLevel() == null) ? 0 : getAlertLevel().hashCode());
        result = prime * result + ((getIndicatorCode() == null) ? 0 : getIndicatorCode().hashCode());
        result = prime * result + ((getCurrentValue() == null) ? 0 : getCurrentValue().hashCode());
        result = prime * result + ((getThresholdValue() == null) ? 0 : getThresholdValue().hashCode());
        result = prime * result + ((getAlertMessage() == null) ? 0 : getAlertMessage().hashCode());
        result = prime * result + ((getAlertTime() == null) ? 0 : getAlertTime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getHandlerId() == null) ? 0 : getHandlerId().hashCode());
        result = prime * result + ((getHandleTime() == null) ? 0 : getHandleTime().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", alertId=").append(alertId);
        sb.append(", ruleId=").append(ruleId);
        sb.append(", deviceId=").append(deviceId);
        sb.append(", alertLevel=").append(alertLevel);
        sb.append(", indicatorCode=").append(indicatorCode);
        sb.append(", currentValue=").append(currentValue);
        sb.append(", thresholdValue=").append(thresholdValue);
        sb.append(", alertMessage=").append(alertMessage);
        sb.append(", alertTime=").append(alertTime);
        sb.append(", status=").append(status);
        sb.append(", handlerId=").append(handlerId);
        sb.append(", handleTime=").append(handleTime);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}